/*
 * @Author: 李超越 1509572300@qq.com
 * @Date: 2024-07-24 12:27:15
 * @LastEditors: 李超越 1509572300@qq.com
 * @LastEditTime: 2024-07-24 13:04:00
 * @FilePath: /my_git/lesson23_buffer/filetest.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "mystdio.h"

const char* filename ="./log.txt";

int main()
{
    myFILE* fp=my_fopen(filename,"w");
    if(fp==NULL)
    {
        return 1;
    }
    int cnt=5;
    char buffer[64];
    while(cnt)
    {
        snprintf(buffer,sizeof(buffer),"hellowprld,%d",cnt--);
        my_fwrite(fp,buffer,strlen(buffer));
        sleep(2);
    }
    my_close(fp);
    return 0;
}